<template>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
    :visible.sync="visible"
    :before-close="cancel"
    class="JNPF-dialog JNPF-dialog_center"
    lock-scroll
    width="80%"
  >
  <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">

        <el-col :span="8">
          <el-form-item label="委托单号" class="required" prop="fbillno">
            <el-input v-model="dataForm.fbillno" disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="委托时间" class="required" prop="forddate" >
            <el-date-picker
              v-model="dataForm.forddate"
              type="date"
              placeholder="选择日期" disabled>
              </el-date-picker>
          </el-form-item>
          </el-col>

          <el-col :span="8">
          <el-form-item label="委托状态" class="required" prop="forduser" >
            <el-select v-model="dataForm.fbillstate" placeholder="请选择" disabled>
              <el-option
                v-for="item in getListSpeakerId"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="委托单位" class="required" prop="forduser" >
            <el-select v-model="dataForm.forduser" placeholder="请选择" disabled>
              <el-option
                v-for="item in getListSpeakerId"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

          <el-col :span="8">
            <el-form-item label="受理人" class="required" prop="frecuser" >
              <el-select v-model="dataForm.frecuser" placeholder="请选择" disabled>
                <el-option
                  v-for="item in getListSpeakerId"
                  :key="item.id"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="完成时间" class="required" prop="foverdate">
               <el-date-picker
                v-model="dataForm.foverdate"
                type="date"
                placeholder="选择日期" disabled>
                </el-date-picker>
            </el-form-item>
          </el-col>


          <el-col :span="8">
            <el-form-item label="质检费用" class="required" prop="ftotalamt" >
              <el-input v-model="dataForm.ftotalamt" disabled/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="品项数" class="required" prop="fitemcount">
              <el-input v-model="dataForm.fitemcount" disabled/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="总件数" class="required" prop="fpiececount">
              <el-input v-model="dataForm.fpiececount" disabled/>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="备注">
              <el-input v-model="dataForm.fexplanation"/>
            </el-form-item>
          </el-col>

      </el-form>
    </el-row>
    <el-tabs style="width: 100%" type="border-card">
     <el-tab-pane label="质检样品">
        <el-table :data="list1" border stripe>
        <el-table-column prop="FENTRYID" label="序号" width="85"></el-table-column>
        <el-table-column prop="FCATNO" label="样品编号" ></el-table-column>
        <el-table-column prop="FCATNAME" label="样品名称"></el-table-column>
        <el-table-column prop="FNUM" label="数量(份)"></el-table-column>
        <el-table-column prop="FUNIT" label="价格"></el-table-column>
        <el-table-column prop="FMONEY" label="金额"></el-table-column>
        <el-table-column prop="FMEMO" label="备注" ></el-table-column>
      </el-table>
    </el-tab-pane>

    <el-tab-pane label="样品标签">
        <el-table :data="list2" border stripe>
        <el-table-column prop="FENTRYID" label="序号" width="85"></el-table-column>
        <el-table-column prop="FCATNO" label="样品编号" ></el-table-column>
        <el-table-column prop="FCATNAME" label="样品名称"></el-table-column>
        <el-table-column prop="FNUM" label="标签码"></el-table-column>
        <el-table-column prop="FMEMO" label="备注" ></el-table-column>
      </el-table>
    </el-tab-pane>

    </el-tabs>

    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
      <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
    </span>
  </el-dialog>
</template>
<style>
  .addbox{
    text-align: center;
    padding: 10px 0;
  }
</style>
<script>
import jnpf from "@/utils/jnpf"
export default {
  data() {
    return {
        title:"新增",
        list1: [{  "FENTRYID":1,
                  "FCATNO": "100001",
                  "FCATNAME": "实验猪配合饲料",
                  "FNUM":10,
                  "FUNIT":"50",
                  "FMONEY":"150",
                  "FMEMO":""
                },
                { "FENTRYID":2,
                  "FCATNO": "100002",
                  "FCATNAME": "实验鸡配合饲料",
                  "FNUM":5,
                  "FUNIT":"20",
                  "FMONEY":"100",
                  "FMEMO":""
                }],
        list2:[{  "FENTRYID":1,
                "FCATNO": "100001",
                "FCATNAME": "实验猪配合饲料",
                "FNUM":"24121500001",
                "FMEMO":""
              },
              { "FENTRYID":2,
                "FCATNO": "100001",
                "FCATNAME": "实验猪配合饲料",
                "FNUM":"24121500002",
                "FMEMO":""
              },
              { "FENTRYID":3,
                "FCATNO": "100001",
                "FCATNAME": "实验猪配合饲料",
                "FNUM":"24121500003",
                "FMEMO":""
              },
              { "FENTRYID":4,
                "FCATNO": "100001",
                "FCATNAME": "实验猪配合饲料",
                "FNUM":"24121500004",
                "FMEMO":""
              },
              { "FENTRYID":5,
                "FCATNO": "100001",
                "FCATNAME": "实验猪配合饲料",
                "FNUM":"24121500005",
                "FMEMO":""
              }],
        catlist:[],
        fdangerlist:[],
        dataForm:{
          fbillno:"P2412160005",
          forddate:"2024-12-16",
          forduser:"上海全是肉供应链管理有限公司",
          frecuser:"曹操",
          foverdate:"2024-12-24",
          fitemcount:2,
          fpiececount:15,
          ftotalamt:5900.00,
          fbillstate:"登记中"
        },
      loading:false,
      visible:false,
      insertorupdate:true
    };
  },
  created() {
  },
  mounted() {},
  methods: {
    //
    init(id){
      this.dataForm.FCATNO= id || ''
        if(this.dataForm.FCATNO)
        {
            this.title="修改"
           this.insertorupdate=false;
        }
        else
        {
          this.insertorupdate=true;
            this.title="新增";
        }
        this.visible=true;
    },
    //
    cancel(){
        this.$refs.elForm.resetFields();
        this.visible=false;
    },
  },
};
</script>
